import aepApiRequest from '../utils/aepApiRequest';

interface AlarmSetting {
  callNotice: boolean;
  ctime: string;
  id: number;
  jgNotice: boolean;
  smsNotice: boolean;
  sno: string;
  userId: number;
  utime: string;
  wechatNotice: boolean;
  wxDoNotDisturb: boolean; // 是否开启免打扰
}

export async function fetchDeviceAlarmSetting(mac: string, pk: string) {
  return aepApiRequest<AlarmSetting>(`app/smart_home/homes/getSingleDeviceNoticeSetting?mac=${mac}&productKey=${pk}`, {
    method: 'GET',
  });
}

export async function updateDeviceAlarmSetting(body: Pick<AlarmSetting, 'id' | 'callNotice' | 'smsNotice' | 'jgNotice' | 'wechatNotice'>) {
  return aepApiRequest<AlarmSetting>(`app/smart_home/homes/singleDeviceNoticeSetting`, {
    method: 'POST',
    body,
  });
}

